package math.spbu.ru.historycharts;

import math.spbu.ru.historycharts.ChartFactory;
import math.spbu.ru.historycharts.ChartsView;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

public class ChartsActivity extends Activity {	
	
	private String rateTypeId;
	private static ChartsView view;
	
	private DataProvider provider;
	
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);	
		
//		Bundle extras = getIntent().getExtras();
//		rateTypeId = extras.getString(WidgetProvider.RATE_TYPE_ID);
//		Log.d("BNV", "rateTypeId "+rateTypeId);
		
		provider = new DataProvider();
		view = ChartFactory.getTimeChartView(this, provider);
		setContentView(view);
	}
	
	public boolean onCreateOptionsMenu(Menu menu) {
		super.onCreateOptionsMenu(menu);
	//	menu.add(0, ADD_CHART, 0, getString(R.string.Add_chart)).setIcon(R.drawable.plus);
	//	menu.add(0, SET_DATE, 0, getString(R.string.Set_Date));
	//	menu.add(0, DELETE_CHART, 0, getString(R.string.Delete_chart)).setIcon(R.drawable.minus);
		return true;
	}
	
//	public boolean onOptionsItemSelected(MenuItem item) {
//		super.onOptionsItemSelected(item);
//		switch (item.getItemId()) {
//			case ADD_CHART:
//				// addAlret.show();
//				return true;
//			case DELETE_CHART:
//				// deleteChart();
//				return true;
//			case SET_DATE:
//				if (dateDialog == null)
//					dateDialog = new DateDialog(this, provider);
//				dateDialog.show();
//
//				return true;
//		}
//		return false;
//	}

	public void repaintView() {
		view.repaint();		
	}	
	
	private final int ADD_CHART = 1, DELETE_CHART = 2, SET_DATE = 3;


	public static View getView() {		
		return view;
	}
}